package com.yanqu.road.server.manager.activity.biaoju;

import com.yanqu.road.entity.activity.biaoju.CrossBiaoJuUserRunEscortData;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

public class BiaoJuRunResult {
    private long baseExp;
    private long baseMoney;
    private int finishLevel;

    private Map<Long, Integer> battleValueMap = new HashMap<>();
    private Map<Integer, Integer> battleLogsMap = new HashMap<>();
    private int unionLevelAddition;
    private int cityRankAddition;
    private int userLevelAddition;
    private int leaderAddition;

    private long joinExpAdd;
    private long joinMoneyAdd;

    private long leaderExpAdd;
    private long leaderMoneyAdd;

    private CrossBiaoJuUserRunEscortData runEscortData;

    public BiaoJuRunResult(CrossBiaoJuUserRunEscortData runEscortData) {
        this.runEscortData = runEscortData;
    }

    public long getBaseExp() {
        return baseExp;
    }

    public void setBaseExp(long baseExp) {
        this.baseExp = baseExp;
    }

    public long getBaseMoney() {
        return baseMoney;
    }

    public void setBaseMoney(long baseMoney) {
        this.baseMoney = baseMoney;
    }

    public Map<Long, Integer> getBattleValueMap() {
        return battleValueMap;
    }

    public void setBattleValueMap(Map<Long, Integer> battleValueMap) {
        this.battleValueMap = battleValueMap;
    }

    public int getUnionLevelAddition() {
        return unionLevelAddition;
    }

    public void setUnionLevelAddition(int unionLevelAddition) {
        this.unionLevelAddition = unionLevelAddition;
    }

    public int getCityRankAddition() {
        return cityRankAddition;
    }

    public void setCityRankAddition(int cityRankAddition) {
        this.cityRankAddition = cityRankAddition;
    }

    public int getUserLevelAddition() {
        return userLevelAddition;
    }

    public void setUserLevelAddition(int userLevelAddition) {
        this.userLevelAddition = userLevelAddition;
    }

    public int getLeaderAddition() {
        return leaderAddition;
    }

    public void setLeaderAddition(int leaderAddition) {
        this.leaderAddition = leaderAddition;
    }

    public void calcReward() {
        BigDecimal moneyMultiAdd = (BigDecimal.ONE.add(BigDecimal.valueOf(unionLevelAddition + cityRankAddition + userLevelAddition).divide(BigDecimal.valueOf(1000), 3, BigDecimal.ROUND_DOWN)));
        BigDecimal expMultiAdd = (BigDecimal.ONE.add(BigDecimal.valueOf(userLevelAddition).divide(BigDecimal.valueOf(1000), 3, BigDecimal.ROUND_DOWN)));

        this.joinMoneyAdd = BigDecimal.valueOf(baseMoney).multiply(moneyMultiAdd).setScale(0,BigDecimal.ROUND_UP).intValue();
        this.joinExpAdd = BigDecimal.valueOf(baseExp).multiply(expMultiAdd).setScale(0,BigDecimal.ROUND_UP).intValue();

        this.leaderMoneyAdd = BigDecimal.valueOf(baseMoney).multiply(moneyMultiAdd).multiply(BigDecimal.valueOf(leaderAddition).divide(BigDecimal.valueOf(1000), 3, BigDecimal.ROUND_DOWN)).setScale(0,BigDecimal.ROUND_UP).intValue();
        this.leaderExpAdd = BigDecimal.valueOf(baseExp).multiply(expMultiAdd).multiply(BigDecimal.valueOf(leaderAddition).divide(BigDecimal.valueOf(1000), 3, BigDecimal.ROUND_DOWN)).setScale(0,BigDecimal.ROUND_UP).intValue();
    }

    public long getJoinExpAdd() {
        return joinExpAdd;
    }

    public long getJoinMoneyAdd() {
        return joinMoneyAdd;
    }

    public long getLeaderExpAdd() {
        return leaderExpAdd;
    }

    public long getLeaderMoneyAdd() {
        return leaderMoneyAdd;
    }

    public Map<Integer, Integer> getBattleLogsMap() {
        return battleLogsMap;
    }

    public void setBattleLogsMap(Map<Integer, Integer> battleLogsMap) {
        this.battleLogsMap = battleLogsMap;
    }

    public CrossBiaoJuUserRunEscortData getRunEscortData() {
        return runEscortData;
    }

    public int getFinishLevel() {
        return finishLevel;
    }

    public void setFinishLevel(int finishLevel) {
        this.finishLevel = finishLevel;
    }
}
